<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="outer">
        <h3>三级标题</h3>
    </div>
    <script>
        let outer = document.getElementById("outer");
        console.log(outer.innerHTML.trim());//文本+html标签
        console.log(outer.innerText);//纯文本

        outer.innerHTML="<h3>三级标题</h3>";
    </script>
</body>
</html>